home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
tpref.exe
/
SOURCE.EXE
/
DEMOTBUF.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-08-07
|
1KB
|
50 lines
{ DEMOTBUF.PAS }
var
PhoneBook : PCollection;
PhoneBookFile : TBufStream;
...
{ TPersonInfo is a collection object holding name and address information }
procedure TPersonInfo.Store ( var S : TStream );
begin
S.Write( Name, SizeOf( Name ));
S.Write( Address, SizeOf( Address ));
S.Write( City, SizeOf( City ));
S.Write( State, SizeOf( State ));
S.Write( Zip, SizeOf( Zip ));
S.Write( Age, SizeOf( Age ));
end;
constructor TPersonInfo.Load ( var S : TStream );
begin
S.Read( Name, SizeOf( Name ));
S.Read( Address, SizeOf( Address ));
S.Read( City, SizeOf( City ));
S.Read( State, SizeOf( State ));
S.Read( Zip, SizeOf( Zip ));
S.Read( Age, SizeOf( Age ));
end;
...
{ Register the PersonInfo object type }
RegisterType( RPersonInfo );
{ Open the stream file }
PhoneBookFile.Init('FONEBOOK.DAT', stCreate, 1024 );
{ Tell the PhoneBook collection to put itself to the stream }
PhoneBookFile.Put( PhoneBook );
{ Close the file }
PhoneBookFile.Done;